# Contributor: Dmitry Zakharchenko <dmitz@disroot.org>
# Maintainer: Dmitry Zakharchenko <dmitz@disroot.org>
pkgname=youtube-viewer
pkgver=3.11.1
pkgrel=0
pkgdesc="Lightweight YouTube client"
url="https://github.com/trizen/youtube-viewer"
arch="noarch"
license="Artistic-2.0"
makedepends="perl-module-build"
depends="
	perl-data-dump
	perl-json
	perl-libwww
	perl-lwp-protocol-https
	perl-term-readline-gnu
	perl-unicode-linebreak
	"
checkdepends="perl-test-pod"
subpackages="$pkgname-doc $pkgname-gtk"
source="$pkgname-$pkgver.tar.gz::https://github.com/trizen/youtube-viewer/archive/$pkgver.tar.gz"

build() {
	perl Build.PL --gtk3 \
		--installdirs=vendor \
		--create_packlist=0
	./Build
}

check() {
	./Build test
}

package() {
	./Build install --destdir="$pkgdir"
}

gtk() {
	depends="$pkgname perl-gtk3 perl-file-sharedir"
	pkgdesc="$pkgdesc (GTK interface)"

	amove "usr/bin/gtk*-youtube-viewer"
	amove "usr/share/perl5/vendor_perl/auto/share/dist/WWW-YoutubeViewer/gtk*"
	amove usr/share/perl5/vendor_perl/auto/share/dist/WWW-YoutubeViewer/icons
}

sha512sums="
4ad037bf0cd15405ad7eebfc3de18d7980759951a5dd5d773536558bd04c57fbb2219dd84a3f92bb738cefa9f0caec5814b5af77d4b57f4b49a612a7ace52524  youtube-viewer-3.11.1.tar.gz
"
